package com.audi.box.service;

import java.util.ArrayList;

import com.audi.box.adapter.SQLiteAsusHelperDevice;
import com.audi.dto.DeviceItem;
import com.audi.dto.PlaceItem;

public class DeviceServiceImp implements DeviceService {
    
    private SQLiteAsusHelperDevice mSQLHelper;
    
    public DeviceServiceImp(SQLiteAsusHelperDevice mSQLHelper) throws Exception {
        this.mSQLHelper = mSQLHelper;
    }
    
    public void setSQLiteHelper(SQLiteAsusHelperDevice mSQLHelper) {
        this.mSQLHelper = mSQLHelper;
    }
    
    /*
     * ADD NEW DEVICE CARD
     */
    @Override
    public int addDevice(DeviceItem device) {
        return mSQLHelper.addDevice(device);
    }
    
    /*
     * ADD NEW DEVICE
     */
    @Override
    public int addNewDevice(DeviceItem device) {
        return mSQLHelper.addDevice(device);
    }
    
    @Override
    public int updateDevice(DeviceItem device) {
        return mSQLHelper.updateDevice(device);
    }
    
    @Override
    public int renameDevice(DeviceItem device) {
        return mSQLHelper.updateDevice(device);
    }
    
    @Override
    public int editPlaceDevice(DeviceItem device) {
        return mSQLHelper.updateDevice(device);
    }
    
    @Override
    public int changePlaceforDeviceItemList(ArrayList<DeviceItem> lstDevice,
            PlaceItem place) {
        return mSQLHelper.changePlaceforDeviceItemList(lstDevice, place);
    }
    
    @Override
    public int changeFavoriteForDeviceList(ArrayList<DeviceItem> lstDevice) {
        return mSQLHelper.changeFavoriteForDeviceList(lstDevice);
    }
    
    @Override
    public int deleteDevice(DeviceItem device) {
        return mSQLHelper.deleteDevice(device);
    }
    
    @Override
    public boolean isExist(DeviceItem device) {
        return mSQLHelper.checkExistDevice(device);
    }
    
    @Override
    public boolean isExistByDeviceName(DeviceItem device) {
        return mSQLHelper.checkExistDeviceByName(device);
    }
    
    @Override
    public boolean isExistByDeviceCode(DeviceItem device) {
        return mSQLHelper.checkExistDeviceByCode(device);
    }
    
    @Override
    public ArrayList<DeviceItem> getListDevice() {
        return mSQLHelper.getListDevice();
    }
    
    @Override
    public ArrayList<DeviceItem> getListDevice(int deviceGroupType) {
        return mSQLHelper.getListDevice(deviceGroupType);
    }
    
    @Override
    public ArrayList<DeviceItem> getListDeviceByUserId(int userId) {
        // TODO Auto-generated method stub
        // no parameter userid ???
        return mSQLHelper.getDeviceByUserId(userId);
    }
    
    @Override
    public ArrayList<DeviceItem> getListDeviceByPlaceId(int placeId) {
        return mSQLHelper.getListDeviceByPlaceId(placeId);
    }
    
    @Override
    public ArrayList<DeviceItem> getListDeviceFavorite() {
        return mSQLHelper.getListDeviceFavorite();
    }
    
    @Override
    public DeviceItem getDevice(int deviceId) {
        return mSQLHelper.getDeviceById(deviceId);
    }
    
    @Override
    public ArrayList<DeviceItem> getDevice(int[] lstDeviceId) {
        return mSQLHelper.getDeviceById(lstDeviceId);
    }
    
    @Override
    public ArrayList<DeviceItem> getNewDevice() {
        return mSQLHelper.getNewDevice();
    }
    
}
